using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SailHero.Soft.FrameWork.Models;

namespace SailHero.Soft.FrameWork.Models.Mapping.PrismMVVM
{
    public class CUSTOMERMap : EntityTypeConfiguration<CUSTOMER>
    {
        public CUSTOMERMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.NAME)
                .IsRequired()
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("CUSTOMER", "SA");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.NAME).HasColumnName("NAME");
            this.Property(t => t.AGE).HasColumnName("AGE");
        }
    }
}
